<div class="fly-header">
    <div class="layui-container">
        <a class="fly-logo" href="{:url('home/index/index')}">
            <img src="/static/home/res/images/logo.png" alt="layui" style="width: 120px;margin-top: -5px;">
        </a>
        <ul class="layui-nav fly-nav-user">
            {if condition="$Request.action != 'login' && $Request.action != 'register'"}
            {if condition="$LoginUser"}

            <button class="layui-btn layui-btn-primary layui-border-blue changeSkin"
                style="margin-left: -10px;">换肤</button>
            <li class="layui-nav-item">
                <a class="fly-nav-avatar" href="{:url('home/user/index')}">
                    <cite class="layui-hide-xs">{$LoginUser['nickname']}</cite>
                    {if condition="$LoginUser.auth == 1"}
                    <i class="iconfont icon-renzheng layui-hide-xs" title="认证信息：{$LoginUser.nickname}"></i>
                    {/if}
                    <!-- <i class="iconfont icon-renzheng layui-hide-xs" title="认证信息：{$LoginUser['nickname']}"></i> -->
                    <i class="layui-badge fly-badge-vip layui-hide-xs">VIP{$LoginUser['vip']}</i>
                    <img src="{$LoginUser['avatar_cdn']}">
                </a>
                <dl class="layui-nav-child">
                    <dd><a href="{:url('home/user/profile')}"><i class="layui-icon">&#xe620;</i>基本资料</a></dd>
                    <dd><a href="{:url('home/user/message')}"><i class="layui-icon"
                                style="margin-left: 2px; font-size: 22px;">&#xe611;</i>我的消息</a></dd>
                    <dd><a href="{:url('home/user/collect')}"><i class="iconfont"
                                style="top: 4px;font-size: 22px;margin-left: 2px;">&#xe60a;</i>收藏记录</a>
                    </dd>
                    <dd><a href="{:url('home/user/record')}"><i class="layui-icon"
                                style="margin-left: 2px; font-size: 22px;">&#xe60a;</i>积分记录</a></dd>
                    <hr style="margin: 5px 0;">
                    <dd><a href="{:url('home/user/logout')}" style="text-align: center;">退出</a></dd>
                </dl>
            </li>
            {else /}
            <!-- 未登入的状态 -->
            <li class="layui-nav-item">
                <a class="iconfont icon-touxiang layui-hide-xs" href="{:url('home/index/login')}"></a>
            </li>
            <li class="layui-nav-item">
                <a href="{:url('home/index/login')}">登入</a>
            </li>
            <li class="layui-nav-item">
                <a href="{:url('home/index/register')}">注册</a>
            </li>
            {/if}
            {/if}
        </ul>
    </div>
</div>

<script>
    let colorArr = ["rgb(204,232,207)", "rgb(200,200,169)", "rgb(114,111,128)", "rgb(152,245,255)", "rgb(105,105,105)"];
    let key = 0;
    if (localStorage.getItem("key")) {
        key = localStorage.getItem("key");
    }
    document.querySelector('.fly-header').style.backgroundColor = colorArr[key];
    document.body.style.background = colorArr[key];
    document.querySelector(".changeSkin").onclick = function () {
        key++;
        key = key > colorArr.length ? 0 : key;
        localStorage.setItem("key", key);
        document.querySelector('.fly-header').style.backgroundColor = colorArr[key];
        document.body.style.background = colorArr[key];
    }
</script>